#include<stdlib.h>
#include<stdio.h>
#define MAXN 100
char str[MAXN];

int str_contain2(){
    char src[] = "AABBCD";
    char des[] = "CDAA";
    char ch;
    int i,j,len = strlen(src);
    for(i=0;i<len;i++){
        ch = src[0];
        for(j=0;j<len-1;j++)
            src[j] = src[j+1];
        src[len-1] = ch;
        if(strstr(src,des))
            return 1;
    }
    return 0;
}

int str_contain(char *a,char *b){
    if(strlen(a) < strlen(b))
        return 0;
    if(strstr(a,b))
        return 1;
    int i,j,k;
    for(i=0;i<strlen(a)-1;i++){
        k = 0;
        memset(str,0,sizeof(str));
        for(j=i+1;j<strlen(a);j++)
            str[k++] = a[j];
        for(j=0;j<=i;j++)
            str[k++] = a[j];
        str[k] = '\0';
        if(strstr(str,b))
            return 1;
    }
    return 0;
}

int main(){
    char *a = "ABCD";
    char *b = "ABCD";
    printf("%d\n",str_contain2());
    return 0;
}
